package acm.pta2;

import java.util.Scanner;

public class T8 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int D = scanner.nextInt();
        int afterTwoDays = (D + 2) % 7;
        if (afterTwoDays == 0) {
            afterTwoDays = 7;
        }
        System.out.println(afterTwoDays);
    }
}